<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('表格传值给父页面')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "lm/serinfotype";
        var datas = [[${@dict.getType('sys_normal_disable')}]];

        $(function() {
            var options = {
                url: prefix + "/listFirstLevel",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
                columns: [{
		            radio: true
		        }
				,
				{
					field: 'id',
					title: '服务id'
				},
				{
					field: 'serviceName',
					title: '服务名称'
				}/*,
				{
					field: 'isHot',
					title: '是否热门服务'
				}*/
				,
				{
					field: 'level',
					title: '分类级别'
				},
				{
					field: 'serviceCode',
					title: '服务代码'
				}]
            };
            $.table.init(options);
        });
        
        /* 添加用户-选择用户-提交 */
		function submitHandler(index, layero) {
			debugger;
			var rows = $.table.selectFirstColumns();
			var parentServiceName = $.table.selectColumns('serviceName');
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			$.modal.close();
			// 父页面的方法
			// parent.selectUsers();
			// 父页面的变量
			//parent.$('#fid').html(rows.join());
			parent.$('#fid').val(rows.join());
			parent.$('#parentServiceName').val( parentServiceName.join());
		}
    </script>
</body>
</html>